<?php


namespace App\Logic;


class GaoLogic
{
    /**
     * @param $address
     * @return mixed
     *高德地图城市转换经纬度
     * @yuankai
     */
    public static function getCity($address)
    {
        $key = config('gao.key');
        $curl = "https://restapi.amap.com/v3/geocode/geo?address=$address&output=JSON&key=$key";
        $content = file_get_contents($curl);
        $result = json_decode($content, true);
        //dd($result);
        $location = $result['geocodes'][0]['location'];
            //将经纬度字符串拆分成经度和纬度
//            $longitude = explode(",",$location)[0];
//            $latitude = explode(",",$location)[1];
        return $location;
    }
}
